class DataCenter {
  constructor(id) {
    this.create(id);
  }
  // 表单id
  formId = null;
  // 实例
  instance = null;

  // 连接器
  connector = {};

  //表单数据
  formValues = {};

  create(id) {
    this.formId = id;
    this.instance = this;
  }
  setConnector = (connector) => {
    this.connector = connector;
  };
  setFormValues = (newValues = {}) => {
    this.formValues = {
      ...this.formValues,
      ...newValues,
    };
    this.connector.eventCenterInstance.addLog({
      name: "valueChange",
      info: { formValues: this.formValues, newValues },
    });
  };
  getFormValue = () => {
    return this.formValues;
  };
}

export default DataCenter;
